package com.demiroot.server.pages;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;

import com.demiroot.server.Cookie;
import com.demiroot.server.HTTPResponse;
import com.demiroot.server.HeaderData;
import com.demiroot.server.ServerUtils;


public class ProxyPageResponse implements HTTPResponse {
	HeaderData head;
	
	public ProxyPageResponse(String url) throws Exception {	
		URLConnection con = new URL(url).openConnection();
		con.connect();
		
		head = new HeaderData(ServerUtils.getHeaderData(con.getInputStream()));
		
		String message = "";
		BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
		while (br.ready()) {
			message += br.readLine();
		}
	}

	public int getCode() {
		return 200;
	}

	public HeaderData getHeader() {
		return null;
	}

	public Object getMessage() {
		return null;
	}

	public ResponseType getResponseType() {
		return null;
	}

	public byte[] getMessageAsByteArray() {
		return ServerUtils.stringToByteArray((String)null);
	}

	@Override
	public List<Cookie> getCookies() {
		return Collections.emptyList();
	}

	@Override
	public Calendar cookieExpire() {
		return null;
	}
	
	
}
